import { http } from '@/utils/request'
import type { AddressParams, getAddList } from '@/types/address'
//添加收货地址
export const addAddressAPI = (data: AddressParams) => {
    return http({
        url: '/member/address',
        method: 'POST',
        data
    })
}

//获取收货地址列表
export const getAddressListAPI = () => {
    return http<getAddList[]>({
        url: '/member/address',
        method: 'GET'
    })
}

//获取收货地址详情
export const getAddressDetailAPI = (id: string) => {
    return http<getAddList>({
        url: `/member/address/${id}`,
        method: 'GET'
    })
}
//修改收货地址
export const putMemberAddressByIdAPI = (id: string, data: AddressParams) => {
    return http({
        url: `/member/address/${id}`,
        method: 'PUT',
        data
    })
}

//删除收货地址
export const deleteMemberAddressAPI = (id: string) => {
    return http({
        url: `/member/address/${id}`,
        method: 'DELETE'
    })
}